package com.jframe.sys.orm.service;

import java.io.Serializable;
import java.util.List;

import com.jframe.sys.controller.utils.QueryHelp;
import com.jframe.sys.orm.utils.ResultSet;

public interface BaseService<T> extends Service {
	public Class getPojoClz();
	public T load(Serializable id);
	public T load(Class clz,Serializable id);
	public T load(String uniKeyField,Serializable id);
	public T load(Class clz,String uniKeyField,Serializable id); 
	void del(Class entiryClz , String ids);
	void del(Class entiryClz , int id);
	void del( String ids);
	void del( int id);
	void del(Serializable id,String field); 
	void del(Class clz,Serializable id,String field);
	public void delete(String hql,Object param);
	public void delete(String hql,Object[] params);
	/**
	 * 批量删除
	 * @param hql
	 * @author:jackyli  
	 */
	void delete(String hql);
	
	/**
	 * 保存
	 * @param obj
	 * @author:jackyli
	 */
	void save(T obj);
	/**
	 * 批量增，删，改
	 * @param insertRecords
	 * @param updateRecords
	 * @param delRecords
	 * @author:jackyli
	 */
	void save(List<T> insertRecords ,List<T> updateRecords,List<T> delRecords);
	void save(List<T> records );
	/**
	 * 批量删除
	 * @param objs
	 * @author:jackyli
	 */
	void del(List<T> objs);
	void del(T obj);
	/**
	 * 
	 * @param condition
	 * @return
	 * @author:jackyli
	 */
	List<T> findAll( );
	List<T> findAll(String clz);
	List<T> findAll(Class clz);	
	List<T> find(String hql);
	List<T> find(String hql ,Object obj);
	List<T> find(String hql,Object[] objs);
	List<T> findList( String condition);
	List<T> findList(T entiryClz,String condition);
	List<T> findList(Class entiryClz,String condition);
	List<T> findListByHql(String hql);	
	List<T> findBySql(String sql);
	List<T> findBySql(String sql,Object obj);
	List<T> findBySql(String sql,Object[] objs);
	public List<T> findList(Class entiryClz,String condition, Object param, int start, int limit);
	public List<T> findList(Class entiryClz,String condition, Object[] params, int start, int limit);
	public List<T> findList(String condition, Object param, int start, int limit);
	public List<T> findList(String condition, Object[] params, int start, int limit);
	public List<T> findListByIds(String ids);
	public List<T> findListByIds(String ids,int start,int limit);
	public ResultSet<T> findListByHql(String hql, int start, int limit);
	ResultSet<T> findListByPage(Class entiryClz ,String condition,int start,int limit);
	ResultSet<T> findListByPage(String condition,int start,int limit);
	ResultSet<T> findListByPage(String condition,Object param,int start,int limit);
	ResultSet<T> findListByPage(String condition,Object[] params,int start,int limit);
	ResultSet<T> findListByPageIds(String ids,int start,int limit);
	

	public ResultSet<T> findListByPage(QueryHelp queryHelp, String conditions,String orderby);
	public ResultSet<T> findListByPage(QueryHelp queryHelp, String conditions,String orderby,int start, int limit);
	public ResultSet<T> findListByPage(QueryHelp queryHelp, String conditions,String orderby,Object param, int start, int limit);
	public ResultSet<T> findListByPage(QueryHelp queryHelp, String conditions,String orderby,Object[] params, int start, int limit);
}
